package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/**
 *序列化
 */
public class oosDemo {
    public static void main(String[] args) throws IOException {
        String name="张三";
        int age=12;
        String gender="nan";
        String []otherInfo={"是一名学生，","黑龙江","打篮球","喜欢啦啦啦"};
        Student zs=new Student(name,age,gender,otherInfo);
        System.out.println(zs);
        //写出来
        FileOutputStream fos=new FileOutputStream("student.txt");
        ObjectOutputStream OOS=new ObjectOutputStream(fos);
        OOS.writeObject(zs);
        System.out.println("写出完毕");
        OOS.close();

    }
}
